<!-- zhouxiang www.zhou-xiang.com -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>uploadPreview演示</title>
    <script src="/static/js/uploadPreview.js" type="text/javascript"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>
    <link href="/static/Wopop_files/style_log.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="/static/Wopop_files/style.css">
    <script>
        window.onload = function () {
            new uploadPreview({ UpBtn: "up_img", DivShow: "imgdiv", ImgShow: "imgShow" });
        }
  $().ready(function() {
// 在键盘按下并释放及提交后验证提交表单
        $("#myForm").validate({
            rules: {
              select: "required",
              select2: "required",
              ftitle: "required",
              fauthor: "required",
              fdesc: "required",
              musicurl: {
                  required: true,
                  url: true
                },
              },
          messages: {
              select: "请选择服务号",
              select2: "请选择订阅号",
              ftitle: "请填写标题",
              fauthor: "请填写作者",
              fdesc: "请填写内容",
              musicurl: "请输入一个正确的url"
          },
        submitHandler: function() {
    //  alert("提交事件!");
            var form = new FormData(document.getElementById("myForm"));
              $.ajax({
                    url:"/upload/do_upload",
                    type:"post",
                    data:form,
                    processData:false,
                    contentType:false,
                    success:function(data){
                        alert("提交成功");
                        window.parent.tabsClose();
                    },
                    error:function(e){
                      alert("错误！！");
                    }
                });   
        }
       });
      return false;
  });

    </script>
</head>
<body class="login" mycollectionplug="bind">
<form id="myForm" action="/upload/do_upload" name="myForm" action="" method="post" enctype="multipart/form-data">
<div class="login_m">
<div class="login_boder">

<div class="login_padding" id="login_model">
<div>
  <span class="s_an" >服务号</span>
  <label style="display: block;padding: 0 0 0 60px;">
  <select name='select[]' class='s8' id="select" style="width:260px; height:36px; border:1px solid #cad2db; background:url(../images/txt_input_bg.gif) no-repeat;  padding:0 5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; line-height:36px; margin-bottom:10px; font-size:14px; color:#717171; font-family:Arial;" value="" required="required">
        <option value=''>— 请选择 —</option>
        <?php
            foreach($arr as $key=>$vo){
              echo "<option value=$vo[uniacid] >$vo[name]</option>";      
            }
        ?>
    </select>
  </label>
</div>
  
<div>
  <span class="s_an" >订阅号</span>
  <label style="display: block;padding: 0 0 0 60px;">
  <select name='select2[]' class='s8' id="select2" style="width:260px; height:36px; border:1px solid #cad2db; background:url(../images/txt_input_bg.gif) no-repeat;  padding:0 5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; line-height:36px; margin-bottom:10px; font-size:14px; color:#717171; font-family:Arial;" value="" required="required">
        <option value=''>— 请选择 —</option>
        <?php
            foreach($arr2 as $key=>$vo){
              echo "<option value=$vo[uniacid] >$vo[name]</option>";      
            }
        ?>
    </select>
  </label>
</div>
<div>
  <span class="s_an" >标题</span>
  <label style="display: block;padding: 0 0 0 60px;">
  <input type="text" id="ftitle" class="txt_input txt_input2" value="" name="ftitle" required="required">
  </label>
</div>
<div>
  <span class="s_an" >作者</span>
  <label style="display: block;padding: 0 0 0 60px;">
  <input type="text" id="fauthor" class="txt_input txt_input2" value="" name="fauthor" required="required">
  </label>
</div>
<div >
<span class="s_an" >内容</span>
  <label style="display: block;padding: 0 0 0 60px;">
  <textarea id="fdesc" class="txt_input txt_input2" rows="8" cols="50" value="" name="fdesc" required="required"></textarea>
  </label>  
</div>
<div>
  <span class="s_an" >音乐链接 </span>
  <label style="display: block;padding: 10px 0 0 60px;">
  <input type="url" id="musicurl" class="txt_input txt_input2" value="<?php echo $music_url ?>" name="musicurl" style="width: 500px;" required="required">
  <p style="color: red">如需修改，请重新填写</p>
  <br/>
  </label>
</div>
<div>

  <span class="s_an" >图片上传 </span>
  <div id="imgdiv"><img id="imgShow" width="250" height="250" src="/static/images/upload.jpg"" />
    <input type="file" id="up_img" name="userfile" size="20" multiple="multiple" value="123"/>
    </div>
</div>
 
  <div class="rem_sub">
    <label>
       <input type="submit" class="sub_button" name="button" id="button" value="确定" style="opacity: 0.7;" >
    </label> 
  </div>
</div>
 
</form>
<!--login_padding  Sign up end-->
</div><!--login_boder end-->
</div><!--login_m end-->
 <br> <br>


</body>
</html>
